package com.ansion.utils.bus


class Event(val action: String) {
    private var mExtras: MutableMap<String, Any>? = null
    private var mType: String? = null
    private var mThreadMode = EventBusThreadMode.COROUTINE

    fun putExtra(name: String, value: Any): Event {
        if (mExtras == null) {
            mExtras = mutableMapOf()
        }

        mExtras!![name] = value
        return this
    }

    fun getExtra(name: String): Any? {
        return mExtras?.get(name)
    }

    fun getType(): String? {
        return mType
    }

    fun setType(type: String): Event {
        mType = "bus/$type"
        return this
    }

    fun getThreadMode(): EventBusThreadMode {
        return mThreadMode
    }

    fun setThreadMode(mode: EventBusThreadMode): Event {
        mThreadMode = mode
        return this
    }
}
